#include "progress.h"
#include <unistd.h>
typedef void (*func)(double total, double current); 
double total = 1024.0;
double speed = 1.0;

void DownLoad(func dl)
{
    double current = 0;
    while(current <= total)
    {
        dl(total, current);
        // 下载代码
        usleep(3000); // 充当下载数据
        current += speed;
    }
    printf("\ndownload %.2lfMB Done\n", current);
}

void UpLoad(func dl)
{
    double current = 0;
    while(current <= total)
    {
        dl(total, current);
        // 下载代码
        usleep(3000); // 充当下载数据
        current += speed;
    }
    printf("\nupload %.2lfMB Done\n", current);
}
int main(){
    DownLoad(FlushProcess);
    DownLoad(FlushProcess);
    UpLoad(FlushProcess);
    UpLoad(FlushProcess);
    // process_v1();
    return 0;
}

